from auto_test.bases.base import Base

# 登录页面的封装, 我们需要定义登录页面的元素和操作
class LoginPage(Base):
    #邮箱/密码/确认密码元素
    email_loc = "//input[@id='basic_email']"
    passwd_loc = "//input[@id='basic_password']"
    signup_loc = "//button[@class='ant-btn css-dev-only-do-not-override-pr0fja ant-btn-primary']"

    signup_url = r"http://localhost:3000/users/login"


    #在构造函数中跳转页面
    def __init__(self,driver):
        super().__init__(driver)
        self.get_url()

    #跳转到指定页面
    def get_url(self):
        self.driver.get(self.signup_url)

    def logins(self,email,passwd):
        self.find_to_ele(self.email_loc).send_keys(email)
        self.find_to_ele(self.passwd_loc).send_keys(passwd)
        self.find_to_ele(self.signup_loc).click()
